/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mvc.controladores;

import java.io.IOException;
import java.io.Serializable;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpSession;

/**
 *
 * @author pezcado
 */
public class CerrarSesionAction extends Action implements Serializable {
    
    String next="";
    HttpSession sesion=null;
    @Override
    public void run() throws ServletException, IOException {

        sesion=request.getSession();
        sesion.invalidate();
        next="/index.jsp";
        RequestDispatcher rd=application.getRequestDispatcher(next);
        if(rd==null)
            throw new ServletException("No se pudo encontrar "+next);
        rd.forward(request, response);

    }

    
}
